import { isObject, isArray } from "./is"
export function get(object, path, defaultValue) {
    if (object == null) {
        return defaultValue;
    }
    const pathArray = Array.isArray(path) ? path : path.split('.');
    let current = object;
    for (let i = 0; i < pathArray.length; i++) {
        const key = pathArray[i];
        current = current[key];

        if (current == null) {
            return defaultValue;
        }
    }
    return current;
}
export const omit = (obj, keys) => {
    if (!isObject(obj)) {
        return {};
    }
    if (!isArray(keys)) {
        return obj
    }
    const clone = { ...obj }
    keys.forEach(key => {
        if (key in clone) {
            delete clone[key]
        }
    })
    return clone
}